package me.hetong.caigou.ui.stage;

import animatefx.animation.FadeIn;
import javafx.application.Application;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import me.hetong.caigou.animate.AnimateUtils;
import me.hetong.caigou.entity.View;
import me.hetong.caigou.ui.ViewFactory;

/**
 * 启动界面
 */
public class LoadingApp extends Application {

    public static final View VIEW;

    static {

        Label label = new Label("菜狗象棋 启动中……");
        label.setStyle("-fx-text-fill: #fff;-fx-padding: 20;");

        VBox vBox = new VBox();
        vBox.getChildren().add(label);

        VIEW = ViewFactory.build(vBox);
    }

    @Override
    public void start(Stage primaryStage) {

        /**
         * 动画显示
         */
        AnimateUtils.a1(new FadeIn(VIEW.getRoot()), actionEvent -> {
            IndexStage.init();
        });

        VIEW.getStage().show();
    }
}
